home *** CD-ROM | disk | FTP | other *** search
- <?
- include ("../lib/config/global_config.php3");
- include ("../lib/phpDB/connect.php3");
- include ("../lib/phpDB/db.php3");
- $db=new db_connect;
- $db->openDB($global_DBServer,$global_DBUser,$global_DBPassword);
- $db->setDatabase($global_DBName);
- $errors = "0000000000"; //firstname|lastname|day|month|year
- if (!ereg("^([a-zA-Z\-\ \.]+)$",$firstname) || $firstname=="") $errors[0]=1;
- if (!ereg("^([a-zA-Z\-\ \.]+)$",$lastname) || $lastname=="") $errors[1]=1;
- //if (!ereg("^[0-9]",$age)) $errors[2]=1;
- if (!$street||$street=="") $errors[2]=1;
- if ($day<1 || $day> 31) $errors[3]=1;
- if ($month<1 || $month>12) $errors[4]=1;
- if ($year <1900 || $year>1995) $errors[5]=1;
- if (!isset($zip) ||$zip=="") $errors[7]=1;
- if ($country==0) $errors[8]=1;
- if ($smoker[0] == 1 && (!ereg("^([a-zA-Z\-\ \.]+)$",$brand) || $brand=="")) $errors[9]=1;
-
- $JetztTag = Date("d");
- $JetztMonat = Date("m");
- $JetztJahr = Date("Y");
- $JetztJahr -= 18;
-
- $JetztDatum = "$JetztJahr-$JetztMonat-$JetztTag";
- $GebDat = "$year-$month-$day";
-
-
- if ($errors!=0000000000) Header("Location:registrier_win.php3?$QUERY_STRING&errors=$errors&eingaben&version=$version#eingaben");
- else if ($JetztDatum < $GebDat)
- {
- Header("Location:too_young.php3?version=$version&firstname=$firstname");
- }
- else
- {
- if ($day<10) $day="0".$day;
- if ($month<10) $month="0".$month;
- $dbquery=new db_query;
- $dbquery->db_connect($db);
- $querystring = "INSERT INTO gewinnspiel_user (name,vorname,bday,weiblich,adresse,telefon,plz,land,loesungswort,raucher,marke,ichwill,bildid) VALUES ('$lastname','$firstname',".$year.$month.$day.",$weiblich,'$street','$phone','$zip',$country,'$lwort',$smoker,'$brand',$ichwill,$bildid)";
- $dbquery->sendQuery($querystring);
- if (mysql_error()!="")
- {
- echo "MySQL Error <b>".mysql_error();
- echo "</b> occured trying to process query <br><b>$querystring</b>";
- }
- else Header("Location:bestaet_win.php3?version=$version&firstname=$firstname");
- }
- ?>
-